<?php

class Sale extends AppModel {

    var $name = 'Sale';
    var $displayField = 'id';
    var $validate = array(
        'sale_amount' => array(
            'numeric' => array(
                'rule' => array('numeric', array('comparison', '>', 0)),
                'message' => 'Solo números',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'sale_amount' => array(
                'rule' => array('comparison', '>', 0),
                'message' => 'Solo valores positivos.'

        ),
        'sale_date' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo Obligatorio',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
    );
    var $hasMany = array(
        'Item' => array(
            'className' => 'Item',
            'foreignKey' => 'sale_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        )
    );

}
